I think I found the source of the problem.
When you use DRAW_COLOR_LINE, the corresponding color mapping buffer usually has to be the next buffer number in sequence. So I changed the buffer indexes:
SetIndexBuffer(0,alma, INDICATOR_DATA); SetIndexBuffer(1,trend, INDICATOR_COLOR_INDEX); SetIndexBuffer(2,EMALine,INDICATOR_DATA); SetIndexBuffer(3,price,INDICATOR_CALCULATIONS); SetIndexBuffer(4,EMALine_BUF,INDICATOR_CALCULATIONS);
Also, if you're only using one color on the 200 EMA then you should rather use DRAW_LINE instead of DRAW_COLOR_LINE, otherwise you'll have to create another color mapping buffer.
Files:
ALMA_smallFix.mq5
12 kb

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 everyone,
before you throw the handbook on me and send me away, please, I confirm that I have tried and done all the research possible. Maybe I have a simple misunderstanding in my edited code, but I can't figure it out alone.
1.) i took the ALMA Indicator V2 and all I wanted to do is to add the EMA-200. I know I can do that by adding a second indicator into the chart, but I want to further use the EMA-200 inside the code to confirm the trend and create some sort of alerts or Buy and sell Errors when the ALMA Trend changes. I do this to verify a strategy before I move on to creating an EA.
2.) the basic ALMA Indicator works well, but when I try to add the iMA(_symbol, Current_timeframe, 200, ..... ) handle and do all the steps necessary to get the data into an array, the plot does not show.
In fact, it kills both, the alma trend plot and the EMA 200 plot.
3.) I did mend all the copyBuffer errors on my own, so the array sizes etc. all fit.
4.) I checked and most awkwardly the indicator counts from latestbar = index of total_rates-1... and first bar on the left in the chart is obviously array[0]
5.) I did set the ArrayAsSeries(EMALine,FALSE) - as this seemed to work.
6.) I plotted the top right (latest) ALMA and EMA Values on a comment in the left top corner - this ist to verify if actually Data is inside the array.
7.) when removing the Alma and replacing it by the EMA line: nothing happens. It's like as if there was no data to be plotted.
8.) I noticed that also the short-name PlotIndexSetString(0,PLOT_LABEL,"ALMA_v2["+timeframeToString(TimeFrame)+"]");
PlotIndexSetString(1,PLOT_LABEL,"EMA_["+IntegerToString(inpEMAPer)+"]");
9.) I don't know where to look for the error. Is it in the top OnInit section by setting the buffers? Or is the error in filling in the data via a ForLoop and byCopyBuffer ?
10.) I highlight the added stuff in yellow
Please help! Or at least could you point me to an indicator that has set this right? I did code indicators in the past, also from the scratch, so I don't really understand why I fail with this one. But obviously reverse-engineering and adding stuff is not easy.
THANK YOU!