1. With iMA() function you get only indicator handle, not the buffer. You should copy the buffer to get the actual vales:
MQL5:double MA1Buffer[]; CopyBuffer(MA1, 0, 0, rates_total, MA1Buffer); double MA2Buffer[]; CopyBuffer(MA2, 0, 0, rates_total, MA2Buffer);
Do this inside your OnCalculate() handler.
2. Then you need compare the buffer values rather than handles when determining the arrow. You also need to give your arrow buffers the actual values rather than just stating them:
MQL5:if (MA2Buffer[i]>MA1MABuffer[i]); {Arrow1[i] = MA2Buffer[i]; } if (MA2Buffer[i]<MA1Buffer[i]); {Arrow2[i] = MA2Buffer[i]; }
3. When you have this working you may want to modify this code to draw arrows only on MA cross, not on all bars, but I don't know if that's relevant for you.
I ask you favour Enivid:is possible you write the code correct completely why i cannot understand probably ...Thanks
Last edited by a moderator: