Not going to work. The indicator running from the iCustom call is not visible.
WHRoeder,
can you explain how "the indicator running from the iCustom call is not visible."? I'm not understanding... On MQL4 docs it says " name of the custom indicator, parameters should go in a strict accordance with the declaration of input variables of this custom indicator." and I think that is what I have...
After seeing another topic in the forum I have changed few things:
Add variables input on EA side:
int period; string indicatorcolor; string indicatorlabel;
and changed the iCustom call:
period = 5; indicatorcolor = "clrBlue"; indicatorlabel = "EMA_Short"; EMAShort = iCustom(NULL,0,"EMACustom_v1",period,indicatorcolor,indicatorlabel,0,0); period = 50; indicatorcolor = "clrRed"; indicatorlabel = "EMA_Long"; EMALong = iCustom(NULL,0,"EMACustom_v1",period,indicatorcolor,indicatorlabel,0,0);
but still doesn't work.
WHRoeder,
can you explain how "the indicator running from the iCustom call is not visible."? I'm not understanding... On MQL4 docs it says " name of the custom indicator, parameters should go in a strict accordance with the declaration of input variables of this custom indicator." and I think that is what I have...
After seeing another topic in the forum I have changed few things:
Add variables input on EA side:
and changed the iCustom call:
but still doesn't work.
The iCustom call suppresses the graphical output completely.
Ovo,
Before i have made the change to customize color and label on iCustom call, I have it fixed on indicator code and it worked and draw 2 EMA on the graphics with to calls of iCustom. The first version is similar to the previous code:
#property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 //--- plot Label1 #property indicator_label1 "EMA_Custom" #property indicator_type1 DRAW_LINE #property indicator_color1 clrBlueViolet #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- External parameters extern int period; //--- indicator buffers double Label1Buffer[]; int OnInit() { SetIndexBuffer(0,Label1Buffer); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ int start() { //--- int limit; int counted_bars; counted_bars = IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(int i=0; i<limit; i++) { Label1Buffer[i]=iMA(NULL,0,period,0,MODE_EMA,PRICE_CLOSE,i); } return(0); }
and draw the 2 EMAs:
The only thing that have changed is the two arguments: color and label on iCustom call...
If you could help also on the others questions, I appreciatte:
- On EA side I have to define property indicator style and label to the iCustom indicator?
- Is theres a way to abdicate the OnCalculate() on the EA side?
Thanks for your attention.
The only place you can see plotting of the buffers from iCustom() is the Strategy Tester. If you are talking about the Strategy Tester, you should have mentioned the fact. No graphical output is generated from iCustom() during normal EA operation.
The OnCalculate() is not the EA method. And no, you cannot avoid it in indicators called by the iCustom(), OnCalculate() is invoked once for a unique set of input parameters.
The only place you can see plotting of the buffers from iCustom() is the Strategy Tester. If you are talking about the Strategy Tester, you should have mentioned the fact. No graphical output is generated from iCustom() during normal EA operation.
The OnCalculate() is not the EA method. And no, you cannot avoid it in indicators called by the iCustom(), OnCalculate() is invoked once for a unique set of input parameters.
Ovo,
You are right! Sorry... I didn't mentioned that I was talking about STester because I didn't know that it only works there! I was thinking that it was going to work in normal EA operation. Thanks...
So, considering that I want to change colors and label using iCustom on STester, can I use this type of call?
EMAShort = iCustom(NULL,0,"EMACustom_v1",5,"clrBlue","EMA_Short",0,0)
and on indicator side use?
//---- drawing settings SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,StringToColor(indicatorcolor)); //---- drawing settings SetIndexLabel(0,indicatorlabel);
Where is the issue?
The iCustom call suppresses the graphical output completely.
Ovo,
You are right! Sorry... I didn't mentioned that I was talking about STester because I didn't know that it only works there! I was thinking that it was going to work in normal EA operation. Thanks...
So, considering that I want to change colors and label using iCustom on STester, can I use this type of call?
and on indicator side use?
Where is the issue?
It's not possible. Use a template.
Zirkoner,
When I use a template in an new chart, manually though, it overrides the symbols that I have created with the EA! Will not append the same when i call the template load function?
I want to have 3 EMAs displayed on the chart and on the EA work with EMAs values... In your opinion do I use iCustom with 3 EMAs or use iMA indicator and load the template?
Will iCustom works with 3 EMAs? I'm little confused...
Thanks.
Hii,
Can anybody help me on the last post? I would appreciatte! :)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I've been studying iCustom to implement a customized EMA indicator on a EA and I have a problem on changing the indicator style and label.
Each time I call iCustom on the EA I would like to set the parameters to the EMA indicator: period, label and color. My intention is to put this customized properties on the EA side ans have as many EMAs I want. Tipycally I want 3 EMAs (short, long and vlong) and my idea is to have only one indicator and call it each time.
The iCustom has worked before I implemented SetIndexStyle and the SetIndexLabel on the indicator and changed the iCustom call on the EA to include the input parameters: EMAShort = iCustom(NULL,0,"EMACustom_v1",5,"clrBlue","EMA_Short",0,0);
I have read that SetIndexStyle and SetIndexLabel can´t be used on EAs, so the doubts are:
- Can I use this iCustom parameters to define indicator style and label?
- On EA side I have to define property indicator style and label to the iCustom indicator?
- Is theres a way to abdicate the OnCalculate() on the EA side? I'm not using it...
The Custom indicator:
and the EA code:
Thanks for your help.
Best regards.