- I use the plain indicator I downloaded on GoogleAre you expecting everyone to try to find which indicator is the indicator your using. There are no mind-readers here. If you had attached it maybe someone might be able to help.
- Is the indicator multi-colored? Then there are multiple buffers (one per color) Use the OTHER one.
WHRoeder:
- I use the plain indicator I downloaded on GoogleAre you expecting everyone to try to find which indicator is the indicator your using. There are no mind-readers here. If you had attached it maybe someone might be able to help.
- Is the indicator multi-colored? Then there are multiple buffers (one per color) Use the OTHER one.
In the navigator screen it is only yellow. Or must I look somewhere else.
It returns the correct value if bullish, but return the EMPTY_VALUE when bearish. So it works perfect, to know if trend is up or down, but I would like to get the bear value returned the same as it returns Bull value.
#property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_width1 3 #property indicator_color2 Red #property indicator_width2 3 //---- input parameters extern int period=80; extern int method=3; // MODE_SMA extern int price=0; // PRICE_CLOSE //---- buffers double Uptrend[]; double Dntrend[]; double ExtMapBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(3); SetIndexBuffer(0, Uptrend); SetIndexBuffer(1, Dntrend); SetIndexBuffer(2, ExtMapBuffer); ArraySetAsSeries(ExtMapBuffer, true); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,3); IndicatorShortName("Slope Direction Line"); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit(){return(0);} double WMA(int x, int p) { return(iMA(NULL, 0, p, 0, method, price, x)); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); int x = 0; int p = MathSqrt(period); int e = Bars - counted_bars + period + 1; double vect[], trend[]; if(e > Bars) e = Bars; ArrayResize(vect, e); ArraySetAsSeries(vect, true); ArrayResize(trend, e); ArraySetAsSeries(trend, true); for(x = 0; x < e; x++) { vect[x] = 2*WMA(x, period/2) - WMA(x, period); } for(x = 0; x < e-period; x++) ExtMapBuffer[x] = iMAOnArray(vect, 0, p, 0, method, x); for(x = e-period; x >= 0; x--) { trend[x] = trend[x+1]; if (ExtMapBuffer[x]> ExtMapBuffer[x+1]) trend[x] =1; if (ExtMapBuffer[x]< ExtMapBuffer[x+1]) trend[x] =-1; if (trend[x]>0) { Uptrend[x] = ExtMapBuffer[x]; if (trend[x+1]<0) Uptrend[x+1]=ExtMapBuffer[x+1]; Dntrend[x] = EMPTY_VALUE; } else if (trend[x]<0) { Dntrend[x] = ExtMapBuffer[x]; if (trend[x+1]>0) Dntrend[x+1]=ExtMapBuffer[x+1]; Uptrend[x] = EMPTY_VALUE; } } return(0); }Here is the indicator code. Works 100%, but return only EMPTY_VALUE on down trend but the real value of the bull trend. But it works 100% to get the trend.
johanmalan:
Here is the indicator code. Works 100%, but return only EMPTY_VALUE on down trend but the real value of the bull trend. But it works 100% to get the trend.
Here is the indicator code. Works 100%, but return only EMPTY_VALUE on down trend but the real value of the bull trend. But it works 100% to get the trend.
Hi
Thanks - Got it. Sorry first time I am using iCustom. Your comment about more than 1 buffer made me realize. I have never programmed an Indicator, only EA's, and Always with standard Indicators.
Thanks, Sorted!!!

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi
I am trying to use the Slope Directional Line Indicator in an EA. It works great, but when it is in Bullish trend it returns the actual value of the indicator which is great, but when it is in a bear trend it returns the EMPTY_VALUE, which show the trend, but I need the value also in a bear trend. How can I get the Slope Directional Indicator to return the values on Bull and Bear trends for me, and not just the EMPTY_VALUE in bear trend. Would help me a lot on my EA.
I use the plain indicator I downloaded on Google.
Thanks