Download MetaTrader 5

Showing color iMA using iCustom, is this the solution?

To add comments, please log in or register
Ernie Gunning
1147
Ernie Gunning  

Hi All,

I would like to change the color of my iMA line via code and seem to strugle to get this simple task done. So I thought if I can do this in iCustom I can spesify the color as one atribute BUT then the color should be a attribute in iMA, right?

 

anyway I have mutliple MAs and I can not have them one color when my EA starts up.

 

Please help.

phi nuts
2184
phi nuts  
ToolMaker:

Hi All,

I would like to change the color of my iMA line via code and seem to strugle to get this simple task done. So I thought if I can do this in iCustom I can spesify the color as one atribute BUT then the color should be a attribute in iMA, right?

anyway I have mutliple MAs and I can not have them one color when my EA starts up.

Please help.

Use MQL5 search and I search for color in code base https://www.mql5.com/en/search#!keyword=color&module=mql5_module_codebase

I found plenty, one of them is Color Line , is that what you're looking for ?

Ernie Gunning
1147
Ernie Gunning  
phi.nuts:

Use MQL5 search and I search for color in code base https://www.mql5.com/en/search#!keyword=color&module=mql5_module_codebase

I found plenty, one of them is Color Line , is that what you're looking for ?

 

Thank phi.nuts for you reply it is appreciated. Let me be more exact and less complicated. I want to use the MT5 build in MA indicator (iMA) but when I initialize it I want to spesify the color.

 

so in my EA's init funtion I will have this line of code below....but I dont know how to specify the color on init of the building indicator functions?  I believe I can do this for a custome MA indicator but dont want to reinvent the wheel...

......(in init function) 

int MAEntrySlowHande = iMA("EURUSD",Period(),20,0,MODE_SMA,PRICE_CLOSE); //want to specify color here , but how?
   if(MAEntrySlowHande==INVALID_HANDLE)
     {
      Print("Failed to create Entry Slow MA indicator. Error ",GetLastError());
      return(INIT_FAILED);
     }

....(rest of init function) 

 

phi nuts
2184
phi nuts  
ToolMaker:

Thank phi.nuts for you reply it is appreciated. Let me be more exact and less complicated. I want to use the MT5 build in MA indicator (iMA) but when I initialize it I want to spesify the color.

 

so in my EA's init funtion I will have this line of code below....but I dont know how to specify the color on init of the building indicator functions?  I believe I can do this for a custome MA indicator but dont want to reinvent the wheel...

......(in init function) 

int MAEntrySlowHande = iMA("EURUSD",Period(),20,0,MODE_SMA,PRICE_CLOSE); //want to specify color here , but how?
   if(MAEntrySlowHande==INVALID_HANDLE)
     {
      Print("Failed to create Entry Slow MA indicator. Error ",GetLastError());
      return(INIT_FAILED);
     }

....(rest of init function) 

 

I guess you have to use iCustom and ChartIndicatorAdd, or else, create a chart template (by right click chart and select templates) and then use ChartApplyTemplate :(

Color is not attribute of indicator, it is an attribute of chart.

 

Ernie Gunning
1147
Ernie Gunning  
phi.nuts:

I guess you have to use iCustom and ChartIndicatorAdd, or else, create a chart template (by right click chart and select templates) and then use ChartApplyTemplate :(

Color is not attribute of indicator, it is an attribute of chart.

 

Cool thanks, "Color is not attribute of indicator, it is an attribute of chart." this help with some understanding. I have 4 iMA indicators my bot creates. Their names are the same in the indicator list :( thus I cant get the indicator via name and try and set properties that way, I have the handles of them all but I dont see functionality to set the color using handles....based on your statment on where the color attribute lies I guess you can't... so dont know how to get the MA line object name...

The reason why I need to do this program matically is because I use the visualiztion strategy tester quite extensivly to make sure my bot adhere to the rules I set out. And it is not easy when you have 4 MA's on a chart all being red and also if their MA_Period values are very close to each other it makes it impossible to monitor your logic... and I might be wrong but you can't modify the color of the indicator on the vizualization tester...right?

THanks, I will try and find a solution. 

new_savage
15
new_savage  
Ernie Gunning:

Cool thanks, "Color is not attribute of indicator, it is an attribute of chart." this help with some understanding. I have 4 iMA indicators my bot creates. Their names are the same in the indicator list :( thus I cant get the indicator via name and try and set properties that way, I have the handles of them all but I dont see functionality to set the color using handles....based on your statment on where the color attribute lies I guess you can't... so dont know how to get the MA line object name...

The reason why I need to do this program matically is because I use the visualiztion strategy tester quite extensivly to make sure my bot adhere to the rules I set out. And it is not easy when you have 4 MA's on a chart all being red and also if their MA_Period values are very close to each other it makes it impossible to monitor your logic... and I might be wrong but you can't modify the color of the indicator on the vizualization tester...right?

THanks, I will try and find a solution. 

Hellor, sorry if this post is long, but i have a similar problem and would appreciate knowing if you've finally found a solution.

Thank in advance.

To add comments, please log in or register